package com.pointi.PatternExtractor;

import java.util.concurrent.ConcurrentLinkedQueue;

import com.pointi.emoTools.DefineParam;

public class emoPatternExtractor
{
	public static void main(String [] args) throws InterruptedException
	{
		// ____________________________________________________________________________________________________
		// Read Configuration Data | Get ServerNo

		String str_conffile = "emoPatternExtractor.conf";
		ConfigurationData conf_data = new ConfigurationData();
		conf_data.InitializeData();
		try
		{
			conf_data = conf_data.ReadConfXML(str_conffile);
			conf_data.WriteLogConfigurationData(conf_data);
		}
		catch (Exception e)
		{
			System.out.println("[EM][SVR] Can't Read XML File!! - "+str_conffile);
			e.printStackTrace();
		}

		//____________________________________________________________________________________________________
		// JDBC
		
		DefineParam define = new DefineParam();
		JDBC jdbc = new JDBC() ;
		jdbc.SetDatabaseParam(conf_data) ;
		int nRet = define.DB_CONNECT_FAIL ;
		while (true) 
		{
			nRet = jdbc.fnConnectDB();
			if (nRet == define.DB_CONNECT_SUCCESS) break;
			System.out.println("[EM][CRT] Record DB Connect - "+nRet);
			Thread.sleep(1000);
		}

		//____________________________________________________________________________________________________
		//
		
		ConcurrentLinkedQueue<ThreadExtractor> manager = new ConcurrentLinkedQueue<ThreadExtractor>() ;
		new ThreadExtractor(manager).start(conf_data, jdbc) ;
		
		//____________________________________________________________________________________________________
		// EOC
	}
}
